package com.company;

import java.util.Arrays;

public class binarySearch {
    public static void main(String[] args)
    {
        double[] score={99.5,100,98,97.5,100,95,85.5,100};
        Arrays.sort(score);
        int index1=Arrays.binarySearch(score,100);
        int index2=Arrays.binarySearch(score,60);
        int index3 = Arrays.binarySearch(score, 2,6,100);
        int index4 = Arrays.binarySearch(score,2,6,60);
        System.out.println("查找到 100 的位置是："+index1);
        System.out.println("查找到 60 的位置是："+index2);
        System.out.println("查找到 100 的位置是："+index3);
        System.out.println("查找到 60 的位置是："+index4);
    }
}
